#!bin/bash

PATTERN_PATH=/mnt/e/project-pattern/
DEPLOY_PATH=$PATTERN_PATH/.environment/deploy

#打包后端项目
cd $PATTERN_PATH
git pull
#
export PATH=/opt/jdk/jdk-15/bin:$PATH
echo $PATH

rm -rf /opt/project-pattern/*
/opt/maven/apache-maven-3.8.1/bin/mvn clean
/opt/maven/apache-maven-3.8.1/bin/mvn \
--update-snapshots -DskipTests=true package -P uat

#复制项目至容器
\cp -r $PATTERN_PATH/run.sh /opt/project-pattern/
mv -f /project-pattern/package/* /opt/project-pattern/
chmod 777 /opt/project-pattern/*

#容器内启动项目
docker exec -i pattern-boot bash -c "/var/app/server/run.sh unzip_restart springbootadmin"
docker exec -i pattern-boot bash -c "/var/app/server/run.sh unzip_restart pattern-gateway"
docker exec -i pattern-boot bash -c "/var/app/server/run.sh unzip_restart socketserver"
docker exec -i pattern-boot bash -c "/var/app/server/run.sh unzip_restart fileboot"
docker exec -i pattern-boot bash -c "/var/app/server/run.sh unzip_restart mainboot"
docker exec -i pattern-boot bash -c "/var/app/server/run.sh unzip_restart smsboot"

cd $DEPLOY_PATH